package cn.dengta.webapp.user.model;

import cn.dengta.common.model.ValueProxy;
import cn.dengta.common.model.ValueProxyImpl;
import lombok.Getter;
import me.codeplayer.util.StringUtil;

/**
 * 礼物类型
 */
@Getter
public enum GiftType implements ValueProxyImpl<GiftType, Integer> {
	/** 钻石 */
	COIN(0, "钻石", "coin.png!dt"),
	/** 视频卡 */
	VIDEO(1, "视频卡", "video.png!dt"),
	/** 语音卡 */
	AUDIO(2, "语音卡", "audio.png!dt"),
	/** 礼物 */
	GIFT(3, "礼物", false, "gift.png!dt"),
	/** VIP */
	VIP(4, "VIP", "vip.png!dt"),
	//
	;
	public final Integer value;
	public final String icon;
	public final boolean show;
	final ValueProxy<GiftType, Integer> proxy;

	GiftType(Integer value, String label, boolean show, String icon) {
		this.value = value;
		this.show = show;
		this.icon = icon;
		this.proxy = new ValueProxy<>(this, value, label);
	}

	public String getIcon() {
		return StringUtil.notEmpty(icon) ? "https://oss.flala6.com/internal/pic/" + icon : icon;
	}

	public String getGreyIcon() {
		return StringUtil.notEmpty(icon) ? "https://oss.flala6.com/internal/pic/grey_" + icon : icon;
	}

	GiftType(Integer value, String label, String icon) {
		this(value, label, true, icon);
	}

	public static GiftType[] getValues() {
		return ValueProxy.getCachedArray(GiftType.class, GiftType::values);
	}

	public static GiftType of(Integer value) {
		return VIDEO.getValueOf(value);
	}

}
